<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>ActionDispatch::MiddlewareStack</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../css/github.css" type="text/css" media="screen" />
<script src="../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>     
    <div class="banner">
        
            <span>Ruby on Rails v4.0.0</span><br />
        
        <h1>
            <span class="type">Class</span> 
            ActionDispatch::MiddlewareStack 
            
                <span class="parent">&lt; 
                    
                    <a href="../Object.html">Object</a>
                    
                </span>
            
        </h1>
        <ul class="files">
            
            <li><a href="../../files/actionpack/lib/action_dispatch/middleware/stack_rb.html">actionpack/lib/action_dispatch/middleware/stack.rb</a></li>
            
        </ul>
    </div>
    <div id="bodyContent">
        <div id="content">
  


  


  
  


  
    <!-- Namespace -->
    <div class="sectiontitle">Namespace</div>
    <ul>
      
        <li>
          <span class="type">CLASS</span>
          <a href="MiddlewareStack/Middleware.html">ActionDispatch::MiddlewareStack::Middleware</a>
        </li>
      
    </ul>
  


  
    <!-- Method ref -->
    <div class="sectiontitle">Methods</div>
    <dl class="methods">
      
        <dt>#</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="MiddlewareStack.html#method-i-5B-5D">[]</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>A</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="MiddlewareStack.html#method-i-assert_index">assert_index</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>B</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="MiddlewareStack.html#method-i-build">build</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>D</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="MiddlewareStack.html#method-i-delete">delete</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>E</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="MiddlewareStack.html#method-i-each">each</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>I</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="MiddlewareStack.html#method-i-initialize_copy">initialize_copy</a>,
              </li>
            
              
              <li>
                <a href="MiddlewareStack.html#method-i-insert">insert</a>,
              </li>
            
              
              <li>
                <a href="MiddlewareStack.html#method-i-insert_after">insert_after</a>,
              </li>
            
              
              <li>
                <a href="MiddlewareStack.html#method-i-insert_before">insert_before</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>L</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="MiddlewareStack.html#method-i-last">last</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>N</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="MiddlewareStack.html#method-c-new">new</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>S</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="MiddlewareStack.html#method-i-size">size</a>,
              </li>
            
              
              <li>
                <a href="MiddlewareStack.html#method-i-swap">swap</a>
              </li>
            
          </ul>
        </dd>
      
        <dt>U</dt>
        <dd>
          <ul>
            
              
              <li>
                <a href="MiddlewareStack.html#method-i-unshift">unshift</a>,
              </li>
            
              
              <li>
                <a href="MiddlewareStack.html#method-i-use">use</a>
              </li>
            
          </ul>
        </dd>
      
    </dl>
  

  
    <!-- Includes -->
    <div class="sectiontitle">Included Modules</div>
    <ul>
      
        <li>
          
            <a href="../Enumerable.html">
              Enumerable
            </a>
          
        </li>
      
    </ul>
  



  

    

    

    


    
      <!-- Section attributes -->
      <div class="sectiontitle">Attributes</div>
      <table border='0' cellpadding='5'>
        
          <tr valign='top'>
            <td class='attr-rw'>
              [RW]
            </td>
            <td class='attr-name'>middlewares</td>
            <td class='attr-desc'></td>
          </tr>
        
      </table>
    


    <!-- Methods -->
    
      <div class="sectiontitle">Class Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-c-new">
            
              <b>new</b>(*args)
            
            <a href="MiddlewareStack.html#method-c-new" name="method-c-new" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/793205cccfb3addd8f6aca59d60655b55e4fc38e/actionpack/lib/action_dispatch/middleware/stack.rb#L57" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-c-new_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/middleware/stack.rb, line 57</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>(*<span class="ruby-identifier">args</span>)
  <span class="ruby-ivar">@middlewares</span> = []
  <span class="ruby-keyword">yield</span>(<span class="ruby-keyword">self</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                  
      <div class="sectiontitle">Instance Public methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-5B-5D">
            
              <b>[]</b>(i)
            
            <a href="MiddlewareStack.html#method-i-5B-5D" name="method-i-5B-5D" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-5B-5D_source')" id="l_method-i-5B-5D_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/793205cccfb3addd8f6aca59d60655b55e4fc38e/actionpack/lib/action_dispatch/middleware/stack.rb#L74" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-5B-5D_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/middleware/stack.rb, line 74</span>
<span class="ruby-keyword">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-keyword ruby-title">i</span>)
  <span class="ruby-identifier">middlewares</span>[<span class="ruby-identifier">i</span>]
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-build">
            
              <b>build</b>(app = nil, &amp;block)
            
            <a href="MiddlewareStack.html#method-i-build" name="method-i-build" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-build_source')" id="l_method-i-build_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/793205cccfb3addd8f6aca59d60655b55e4fc38e/actionpack/lib/action_dispatch/middleware/stack.rb#L115" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-build_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/middleware/stack.rb, line 115</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">build</span>(<span class="ruby-identifier">app</span> = <span class="ruby-keyword">nil</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">app</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">block</span>
  <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;MiddlewareStack#build requires an app&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">app</span>
  <span class="ruby-identifier">middlewares</span>.<span class="ruby-identifier">freeze</span>.<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-identifier">app</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">build</span>(<span class="ruby-identifier">a</span>) }
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-delete">
            
              <b>delete</b>(target)
            
            <a href="MiddlewareStack.html#method-i-delete" name="method-i-delete" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-delete_source')" id="l_method-i-delete_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/793205cccfb3addd8f6aca59d60655b55e4fc38e/actionpack/lib/action_dispatch/middleware/stack.rb#L106" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-delete_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/middleware/stack.rb, line 106</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">delete</span>(<span class="ruby-identifier">target</span>)
  <span class="ruby-identifier">middlewares</span>.<span class="ruby-identifier">delete</span> <span class="ruby-identifier">target</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-each">
            
              <b>each</b>()
            
            <a href="MiddlewareStack.html#method-i-each" name="method-i-each" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-each_source')" id="l_method-i-each_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/793205cccfb3addd8f6aca59d60655b55e4fc38e/actionpack/lib/action_dispatch/middleware/stack.rb#L62" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-each_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/middleware/stack.rb, line 62</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">each</span>
  <span class="ruby-ivar">@middlewares</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-keyword">yield</span> <span class="ruby-identifier">x</span> }
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-initialize_copy">
            
              <b>initialize_copy</b>(other)
            
            <a href="MiddlewareStack.html#method-i-initialize_copy" name="method-i-initialize_copy" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-initialize_copy_source')" id="l_method-i-initialize_copy_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/793205cccfb3addd8f6aca59d60655b55e4fc38e/actionpack/lib/action_dispatch/middleware/stack.rb#L83" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-initialize_copy_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/middleware/stack.rb, line 83</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize_copy</span>(<span class="ruby-identifier">other</span>)
  <span class="ruby-keyword">self</span>.<span class="ruby-identifier">middlewares</span> = <span class="ruby-identifier">other</span>.<span class="ruby-identifier">middlewares</span>.<span class="ruby-identifier">dup</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-insert">
            
              <b>insert</b>(index, *args, &amp;block)
            
            <a href="MiddlewareStack.html#method-i-insert" name="method-i-insert" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
            <div class="aka">
              Also aliased as: <a href="MiddlewareStack.html#method-i-insert_before">insert_before</a>
            </div>
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-insert_source')" id="l_method-i-insert_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/793205cccfb3addd8f6aca59d60655b55e4fc38e/actionpack/lib/action_dispatch/middleware/stack.rb#L87" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-insert_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/middleware/stack.rb, line 87</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">insert</span>(<span class="ruby-identifier">index</span>, *<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">index</span> = <span class="ruby-identifier">assert_index</span>(<span class="ruby-identifier">index</span>, <span class="ruby-value">:before</span>)
  <span class="ruby-identifier">middleware</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span><span class="ruby-operator">::</span><span class="ruby-constant">Middleware</span>.<span class="ruby-identifier">new</span>(*<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">middlewares</span>.<span class="ruby-identifier">insert</span>(<span class="ruby-identifier">index</span>, <span class="ruby-identifier">middleware</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-insert_after">
            
              <b>insert_after</b>(index, *args, &amp;block)
            
            <a href="MiddlewareStack.html#method-i-insert_after" name="method-i-insert_after" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-insert_after_source')" id="l_method-i-insert_after_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/793205cccfb3addd8f6aca59d60655b55e4fc38e/actionpack/lib/action_dispatch/middleware/stack.rb#L95" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-insert_after_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/middleware/stack.rb, line 95</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">insert_after</span>(<span class="ruby-identifier">index</span>, *<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">index</span> = <span class="ruby-identifier">assert_index</span>(<span class="ruby-identifier">index</span>, <span class="ruby-value">:after</span>)
  <span class="ruby-identifier">insert</span>(<span class="ruby-identifier">index</span> <span class="ruby-operator">+</span> <span class="ruby-number">1</span>, *<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-insert_before">
            
              <b>insert_before</b>(index, *args, &amp;block)
            
            <a href="MiddlewareStack.html#method-i-insert_before" name="method-i-insert_before" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-last">
            
              <b>last</b>()
            
            <a href="MiddlewareStack.html#method-i-last" name="method-i-last" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-last_source')" id="l_method-i-last_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/793205cccfb3addd8f6aca59d60655b55e4fc38e/actionpack/lib/action_dispatch/middleware/stack.rb#L70" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-last_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/middleware/stack.rb, line 70</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">last</span>
  <span class="ruby-identifier">middlewares</span>.<span class="ruby-identifier">last</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-size">
            
              <b>size</b>()
            
            <a href="MiddlewareStack.html#method-i-size" name="method-i-size" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-size_source')" id="l_method-i-size_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/793205cccfb3addd8f6aca59d60655b55e4fc38e/actionpack/lib/action_dispatch/middleware/stack.rb#L66" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-size_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/middleware/stack.rb, line 66</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">size</span>
  <span class="ruby-identifier">middlewares</span>.<span class="ruby-identifier">size</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-swap">
            
              <b>swap</b>(target, *args, &amp;block)
            
            <a href="MiddlewareStack.html#method-i-swap" name="method-i-swap" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-swap_source')" id="l_method-i-swap_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/793205cccfb3addd8f6aca59d60655b55e4fc38e/actionpack/lib/action_dispatch/middleware/stack.rb#L100" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-swap_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/middleware/stack.rb, line 100</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">swap</span>(<span class="ruby-identifier">target</span>, *<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">index</span> = <span class="ruby-identifier">assert_index</span>(<span class="ruby-identifier">target</span>, <span class="ruby-value">:before</span>)
  <span class="ruby-identifier">insert</span>(<span class="ruby-identifier">index</span>, *<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">middlewares</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">index</span> <span class="ruby-operator">+</span> <span class="ruby-number">1</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-unshift">
            
              <b>unshift</b>(*args, &amp;block)
            
            <a href="MiddlewareStack.html#method-i-unshift" name="method-i-unshift" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-unshift_source')" id="l_method-i-unshift_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/793205cccfb3addd8f6aca59d60655b55e4fc38e/actionpack/lib/action_dispatch/middleware/stack.rb#L78" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-unshift_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/middleware/stack.rb, line 78</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">unshift</span>(*<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">middleware</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span><span class="ruby-operator">::</span><span class="ruby-constant">Middleware</span>.<span class="ruby-identifier">new</span>(*<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">middlewares</span>.<span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">middleware</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
        
        <div class="method">
          <div class="title method-title" id="method-i-use">
            
              <b>use</b>(*args, &amp;block)
            
            <a href="MiddlewareStack.html#method-i-use" name="method-i-use" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-use_source')" id="l_method-i-use_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/793205cccfb3addd8f6aca59d60655b55e4fc38e/actionpack/lib/action_dispatch/middleware/stack.rb#L110" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-use_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/middleware/stack.rb, line 110</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">use</span>(*<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">middleware</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span><span class="ruby-operator">::</span><span class="ruby-constant">Middleware</span>.<span class="ruby-identifier">new</span>(*<span class="ruby-identifier">args</span>, &amp;<span class="ruby-identifier">block</span>)
  <span class="ruby-identifier">middlewares</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">middleware</span>)
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
              
      <div class="sectiontitle">Instance Protected methods</div>
      
        <div class="method">
          <div class="title method-title" id="method-i-assert_index">
            
              <b>assert_index</b>(index, where)
            
            <a href="MiddlewareStack.html#method-i-assert_index" name="method-i-assert_index" class="permalink">Link</a>
          </div>
          
          
            <div class="description">
              
            </div>
          
          
          
          
          
            
            <div class="sourcecode">
              
              <p class="source-link">
                Source: 
                <a href="javascript:toggleSource('method-i-assert_index_source')" id="l_method-i-assert_index_source">show</a>
                
                  | <a href="https://github.com/rails/rails/blob/793205cccfb3addd8f6aca59d60655b55e4fc38e/actionpack/lib/action_dispatch/middleware/stack.rb#L123" target="_blank" class="github_url">on GitHub</a>
                
              </p>
              <div id="method-i-assert_index_source" class="dyn-source">
                <pre><span class="ruby-comment"># File actionpack/lib/action_dispatch/middleware/stack.rb, line 123</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">assert_index</span>(<span class="ruby-identifier">index</span>, <span class="ruby-identifier">where</span>)
  <span class="ruby-identifier">i</span> = <span class="ruby-identifier">index</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Integer</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">index</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">middlewares</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">index</span>)
  <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;No such middleware to insert #{where}: #{index.inspect}&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">i</span>
  <span class="ruby-identifier">i</span>
<span class="ruby-keyword">end</span></pre>
              </div>
            </div>
            
          </div>
                    </div>

    </div>
  </body>
</html>    